/***********************************
 *           3/24/2014             *
 *       by Meow dev (arm genesis) *
 *                                 *
 ***********************************/
package com.meow.dev.engine;

public class UserDataEncode {
	private long[] fingerData = new long[459];
	private long passwordAndCard = 0;

	public long[] getFingerData() {
		return fingerData;
	}

	public void setFingerData(long[] fingerData) {
		this.fingerData = fingerData;
	}

	public long getPasswordAndCard() {
		return passwordAndCard;
	}

	public void setPasswordAndCard(long passwordAndCard) {
		this.passwordAndCard = passwordAndCard;
	}

	public int getFingerSize() {
		int i = 0;
		for (long d : fingerData) {
			if (d == 0) {
				break;
			}
			i++;
		}
		return i;
	}

	public String fingerToString( int size){
		StringBuilder stringBuilder = new StringBuilder();
		for(int i = 0 ; i < size ; i++ ){
			stringBuilder.append( fingerData[i]);
			if( i != size -1)
				stringBuilder.append("#");
		}
		if(size == 0){
			stringBuilder.append("0");
		}
		return stringBuilder.toString();
	}
	
	public String getRawFingerData(){
		return fingerToString(getFingerSize());
	}
	@Override
	public String toString() {
		return " passwordAndCard=" + passwordAndCard +
				", fingerData=" + getRawFingerData();
	}

}
